<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>

<?php
/** @var $this \Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Files\Content\Files */
?>

<?php if ($this->getFilesCount() > 0): ?>

    <div name="css-editor">
        <?php if ($this->getStorageType() == \Magento\Theme\Model\Wysiwyg\Storage::TYPE_FONT): ?>
            <div class="uploader">
                <?php foreach ($this->getFiles() as $file): ?>
                    <div class="file-row filecnt file-font" id="<?php echo $file['id'] ?>">
                        <span class="file-info-name">
                            <?php echo $file['text'] ?>
                        </span>
                        <span class="file-info-details">
                            <a href="#" class="action-add" title="<?php echo __('Insert file'); ?>" data-insert-file="<?php echo $file['id'] ?>">
                                <span><?php echo __('Insert file'); ?></span>
                            </a>
                        </span>
                        <span class="file-icon">
                            <a href="#" class="action-delete" title="<?php echo __('Delete file'); ?>" data-delete-file="<?php echo $file['id'] ?>">
                                <span><?php echo __('Delete file'); ?></span>
                            </a>
                        </span>
                    </div>
                <?php endforeach; ?>
            </div>
        <?php else: ?>
            <div class="uploader-image">
                <?php foreach ($this->getFiles() as $file): ?>
                    <div class="image base-image asset-image css-editor-image filecnt file-row" id="<?php echo $file['id'] ?>">
                        <?php if (isset($file['thumbnailParams'])): ?>
                            <img class="spacer" src="<?php echo $this->getViewFileUrl('images/spacer.gif') ?>"/>
                            <img src="<?php echo $this->getUrl('*/*/previewImage', $file['thumbnailParams']) ?>">
                        <?php endif; ?>
                        <img class="spacer" src="<?php echo $this->getViewFileUrl('images/spacer.gif') ?>"/>
                        <div>
                            <?php echo $file['width'] ?>x<?php echo $file['height'] ?> px.
                        </div>
                        <div class="image-text">
                            <?php echo $file['text'] ?>
                        </div>
                        <div class="actions">
                            <a href="#" class="action-delete" title="<?php echo __('Delete file'); ?>" data-delete-file="<?php echo $file['id'] ?>">
                                <span><?php echo __('Delete file'); ?></span>
                            </a>
                            <a href="#" class="action-add" title="<?php echo __('Insert file'); ?>" data-insert-file="<?php echo $file['id'] ?>">
                                <span><?php echo __('Insert file'); ?></span>
                            </a>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>
        <?php endif; ?>
    </div>

<?php endif; ?>
